// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"

/**
 * 
 */
class TANKALGORITHM_API MyAlgorithm
{
public:
	MyAlgorithm();
	~MyAlgorithm();
	static void algorithm_primary(AActor* tank);
	static void algorithm_second(AActor* tank);
	static void algorithm_third(AActor* tank);
	static void algorithm_forth(AActor* tank);
	static void tankMove(AActor* tank, FVector & start, FVector & end);
	static void tankMoveTest(AActor* tank, FVector& start, FVector& end);
	static void setLocation(AActor* tank, FVector& location);
	static FRotator CalculateRotationFromCoordinates(const FVector& PreviousCoordinate, const FVector& CurrentCoordinate);
private:
	static const int speed = 15;
};

class MyRunnable : public FRunnable {
public:
	MyRunnable(AActor* tank, int order) {
		this->tank = tank;
		this->order = order;
	}
	bool Init() override {
		return true;
	}
	uint32 Run() override {
		if (order == 1) {
			MyAlgorithm::algorithm_primary(tank);
		}
		else if (order == 2) {
			MyAlgorithm::algorithm_second(tank);
		}
		else if (order == 3) {
			MyAlgorithm::algorithm_third(tank);
		}
		else {
			MyAlgorithm::algorithm_forth(tank);
		}
		return 1;
	}
	void Stop() override {
		return;
	}
	AActor* tank;
private:
	int order;
};